package com.zzh.arc;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.NonNull;

import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;
import com.zzh.lib.core.utils.ToastUtils;

import java.util.List;

/**
 * Created by zzh on 2024/9/12.
 *
 * @date: 2024/9/12 15:25
 * @email: zzh_hz@126.com
 * @author: zzh
 * @description: com.zzh.arc
 */
public class Launcher extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        XXPermissions.with(this).permission(Permission.SYSTEM_ALERT_WINDOW).request(new OnPermissionCallback() {
            @Override
            public void onGranted(@NonNull List<String> permissions, boolean allGranted) {
                ToastUtils.show("授予权限悬浮窗");
                if (allGranted){
                    Intent intent = new Intent(Launcher.this, FloatViewService.class);
                    startService(intent);
                }
                finish();
            }
        });

    }
}